//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package common;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;

public class cfgFile extends Properties {
    private static final long serialVersionUID = 7685508407882336449L;
    private final String fileName;

    public cfgFile(String fileName) {
        this.fileName = fileName;
    }

    public synchronized Enumeration<Object> keys() {
        ArrayList keyList = new ArrayList();
        Iterator var3 = super.keySet().iterator();

        while(var3.hasNext()) {
            Object key = var3.next();
            keyList.add((String)key);
        }

        Collections.sort(keyList, new Comparator() {
            public int compare(Object o1, Object o2) {
                byte retval = 0;
                String[] s1 = o1.toString().split("\\.");
                String[] s2 = o2.toString().split("\\.");
                int var10;
                if(s1.length != s2.length) {
                    var10 = s1.length - s2.length;
                    return var10;
                } else if(s1.length == 0) {
                    return retval;
                } else {
                    int maxiter = s1.length - 1;
                    String cp1 = new String();
                    String cp2 = new String();

                    for(int i = 0; i < maxiter; ++i) {
                        cp1 = cp1 + s1[i];
                        cp2 = cp2 + s2[i];
                    }

                    var10 = cp1.compareTo(cp2);
                    if(var10 == 0) {
                        var10 = Integer.valueOf(s1[maxiter]).intValue() - Integer.valueOf(s2[maxiter]).intValue();
                    }

                    return var10;
                }
            }
        });
        return Collections.enumeration(new ArrayList(keyList));
    }

    public void cfgstore(String comment) throws IOException {
        FileOutputStream os = new FileOutputStream(this.fileName);
        super.store(os, comment);
        os.flush();
        os.close();
    }
}
